package com.qfedu.yanglao20admin.scoreManager.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qfedu.yanglao20admin.health.entity.HealthData;
import com.qfedu.yanglao20admin.scoreManager.dao.ScoreManagerDao;
import com.qfedu.yanglao20admin.scoreManager.entity.ScoreManager;
import com.qfedu.yanglao20admin.scoreManager.param.ScoreManagerParam;
import com.qfedu.yanglao20admin.scoreManager.service.ScoreManagerService;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.List;

/**
 * (ScoreManager)表服务实现类
 *
 * @author makejava
 * @since 2023-04-24 17:14:40
 */
@Service("scoreManagerService")
public class ScoreManagerServiceImpl implements ScoreManagerService {
    @Resource
    private ScoreManagerDao scoreManagerDao;

    @Override
    public ScoreManager queryid(Integer id) {
        return scoreManagerDao.queryById(id);
    }

    /**
     * 更新分数信息
     *
     * @param scoreManager
     * @return
     */
    @Override
    public void updateScore(ScoreManager scoreManager) {
     scoreManagerDao.queryScoreManager(scoreManager);
    }

    /**
     * 更具数据类型删除数据
     *
     * @param
     * @return
     */
    @Override
    public int deleteByid(Integer id) {
        return scoreManagerDao.deleteByid(id);
    }

    /**
     * 添加分值信息
     *
     * @param scoreManager
     * @return
     */
    @Override
    public void insertScore(ScoreManager scoreManager) {
     scoreManagerDao.insertScore(scoreManager);
    }

    /**
     * 分页查询应用服务信息
     *
     * @param param
     * @return
     */
    @Override
    public Page<ScoreManager> pagescore(ScoreManagerParam param) {
        Page<ScoreManager> page = new Page<>(param.getPageNum(), param.getPageSize());
        List<ScoreManager> scoreManagers = scoreManagerDao.selectList(param);

        // 页码
        page.setCurrent(param.getPageNum());
        page.setSize(param.getPageSize());

        page.setRecords(scoreManagers);

        return page;
    }

    /**
     * 更具数据类型查询数据
     *
     * @param data
     * @return
     */
    @Override
    public ScoreManager queryBydata(String data) {
        return scoreManagerDao.queryByData(data);
    }
}
